<?php

namespace App\Models\Shop;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class WxShopGoodsProduct extends Model
{
	use HasDateTimeFormatter;
//    use SoftDeletes;

    protected $table = 'wx_shop_goods_product';


    public function batchAdd($data){
        DB::table($this->table)->insert($data);
    }

    public function getPriceAttribute($v){
        if($this->credit_type == 1){
            return $v;
        }else{
            return (int)$v;
        }
    }

    public function getVipPriceAttribute($v){
        if($this->credit_type == 1){
            return $v;
        }else{
            return (int)$v;
        }
    }

}
